import ProductCard from "./components/ProductCard";
import {useEffect, useState} from "react";
import {product} from "./service";
import Top from "@/pages/index/components/Top";
import Ad from "./components/Ad";
import SearchPanel from "../../components/SearchPanel";

export default () => {
  const [data, setData] = useState<Record<string, any>[]>([]);
  useEffect(() => {
    product({}).then(result => {
      setData(result.data);
    })
  }, []);

  return (
    <>
      <SearchPanel />
      <div style={{height:56}} />
      <Top />
      <div style={{height:24}} />
      <Ad />
      <div style={{height:24}} />
      {
        data.map(item => (
          <ProductCard key={item.key} title={item.name} list={item.list || []}/>
        ))
      }
    </>
  )
}
